package com.zjp.birthdaymanager;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;

public class BirthDetailActivity extends Activity implements View.OnClickListener{
    //返回键
    private ImageView mBack;
    //发送短信
    private ImageView mSendSms;
    //打电话
    private ImageView mCallPhone;

    private TextView tv_name, tv_day, tv_remark;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_birth_detail);

        Intent intent = getIntent();
        String strName = intent.getStringExtra("strName");
        String strBirthdate = intent.getStringExtra("strBirthdate");
        String strPhone = intent.getStringExtra("strPhone");
        String strRemark = intent.getStringExtra("strRemark");

        mBack = (ImageView) findViewById(R.id.iv_detail_back);
        mSendSms = (ImageView) findViewById(R.id.iv_detail_sendsms);
        mCallPhone = (ImageView) findViewById(R.id.iv_detail_call);
        tv_name = (TextView) findViewById(R.id.tv_detial_name);
        tv_day = (TextView) findViewById(R.id.tv_detial_day);
        tv_remark = (TextView) findViewById(R.id.tv_detial_remark);
        tv_name.setText(strName);
        tv_day.setText(strBirthdate);
        tv_remark.setText(strRemark);

        mBack.setOnClickListener(this);
        mSendSms.setOnClickListener(this);
        mCallPhone.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_detail_back:
                finish();
            break;
            case R.id.iv_detail_sendsms:
                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_SENDTO);
                intent.setData(Uri.parse("smsto:13163788849"));
                intent.putExtra("sms_body","生日快乐");
                startActivity(intent);
                break;
            case R.id.iv_detail_call:
                Intent intent2 = new Intent();
                intent2.setAction(Intent.ACTION_CALL);
                intent2.setData(Uri.parse("tel:13163788849"));
                startActivity(intent2);
                break;
        }
    }
}
